﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Channelvn.Cached;
using Core.Library;

namespace DataObject.Upload
{
    public class UploadCache
    {
        public static bool UploadImage_TimeExpire(int memberId)
        {
            var listParams = new object[] { memberId };
            var cacheName = CacheHelper.CacheKey.GetCacheKey("UploadImage_TimeExpire", listParams);
            var fromcache = CacheController.GetCache(Constants.DATA_CACHE_CATEGORY, cacheName);
            if (fromcache != null)
            {
                return false;
            }
            else
            {
                CacheController.Add(Constants.DATA_CACHE_CATEGORY, cacheName, true, Constants._10second);
                return true;
            }
        }

        public static bool UploadConfirm_TimeExpire(int memberId)
        {
            var listParams = new object[] { memberId };
            var cacheName = CacheHelper.CacheKey.GetCacheKey("UploadConfirm_TimeExpire", listParams);
            var fromcache = CacheController.GetCache(Constants.DATA_CACHE_CATEGORY, cacheName);
            if (fromcache != null)
            {
                return false;
            }
            else
            {
                CacheController.Add(Constants.DATA_CACHE_CATEGORY, cacheName, true, Constants._30second);
                return true;
            }
        }
    }
}
